package IO_study.serializable;

import java.io.Serializable;

/**
 * 对象如果要序列话,必须实现Serializable序列化接口
 */
public class Student implements Serializable {
   // 申明序列化的版本号
    // 序列化的版本号与反序列化的版本号必须一致才不会出错
    private static final long serialVersionUID = 1;

    private String name;
    private String loginName;
    // transient修饰的成员变量不参与序列化
    private transient String password;
    private int age;

    public Student() {
    }

    public Student(String name, String loginName, String password, int age) {
        this.name = name;
        this.loginName = loginName;
        this.password = password;
        this.age = age;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return loginName
     */
    public String getLoginName() {
        return loginName;
    }

    /**
     * 设置
     * @param loginName
     */
    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    /**
     * 获取
     * @return password
     */
    public String getPassword() {
        return password;
    }

    /**
     * 设置
     * @param password
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    public String toString() {
        return "Student{name = " + name + ", loginName = " + loginName + ", password = " + password + ", age = " + age + "}";
    }
}
